package com.tuweiya.study.springmvc001.eventBus.subscriber;

import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;

import java.util.concurrent.Executors;

/**
 * @Author: Mr_tu
 * @Date: Create in 14:31 2018/6/7
 * @Description: 订阅者中心
 */
public class EventBusCenter {

//    private static EventBus eventBus = new EventBus();

    private static AsyncEventBus eventBus = new AsyncEventBus(Executors.newFixedThreadPool(100));

    public static EventBus getInstance(){
        return eventBus;
    }

    // 注册
    public static void register(Object o){
        eventBus.register(o);
    }

    // 取消
    public static void unRegister(Object o){
        eventBus.unregister(o);
    }

    // 发布
    public static void post(Object o){
        eventBus.post(o);
    }



}
